package com.admin.exam.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.admin.base.Page;
import com.admin.exam.dao.PersonInfoMapper;
import com.admin.exam.entity.PersonInfo;
import com.admin.exam.vo.query.PersonInfoQuery;

/**
 * 操作相关
 */
@Service
public class PersonInfoService {
    @Autowired
    private PersonInfoMapper personInfoMapper;

    public PersonInfo getById(Integer id) {
        return personInfoMapper.getByPrimaryKey(id);
    }

    public PersonInfo getPersonInfoByPhone(String phone) {
        return personInfoMapper.getPersonInfoByPhone(phone);
    }

    public void add(PersonInfo record) {
        personInfoMapper.insertSelective(record);
    }

    /**
     * 批量删除
     */
    public void delete(Integer[] ids) {
        for (Integer id : ids) {
            personInfoMapper.deleteByPrimaryKey(id);
        }
    }

    public void update(PersonInfo record) {
        personInfoMapper.updateByPrimaryKeySelective(record);
    }

    public void updateByPhone(PersonInfo record) {
        personInfoMapper.updateByPhone(record);
    }

    public List<PersonInfo> listByConditions(PersonInfoQuery query) {
        return personInfoMapper.listByConditions(query);
    }

    public List<PersonInfo> getPersonalRank() {
        return personInfoMapper.getPersonalRank();
    }

    public List<PersonInfo> getHospitalRank() {
        return personInfoMapper.getHospitalRank();
    }

    public Long pageCount(PersonInfoQuery query) {
        return personInfoMapper.pageCount(query);
    }

    public Page<PersonInfo> pagingByConditions(PersonInfoQuery query) {
        return personInfoMapper.pagingByConditions(query);
    }
}

